package com.dodola.flip;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link DetailFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link DetailFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DetailFragment extends Fragment {
private WebView mWebview;
private String mUrl;
public static DetailFragment newInstance(String url) {
DetailFragment fragment = new DetailFragment();
Bundle args = new Bundle();
args.putString("url", url);
fragment.setArguments(args);
return fragment;
}
public DetailFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mUrl = getArguments().getString("url");
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_blank, container, false);
mWebview = (WebView) view.findViewById(R.id.h5_web);
WebSettings webSettings = mWebview.getSettings();
webSettings.setSupportZoom(false);
webSettings.setPluginState(WebSettings.PluginState.ON);
webSettings.setLoadWithOverviewMode(true);
webSettings.setJavaScriptEnabled(true);
mWebview.setWebChromeClient(new WebChromeClient());
mWebview.setWebViewClient(new WebViewClient());
mWebview.loadUrl(mUrl);
DetailAnimViewGroup wrapper = new DetailAnimViewGroup(inflater.getContext(), view, 0);
wrapper.setReversed(false);
return wrapper;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
}
@Override
public void onDetach() {
super.onDetach();
}
}